#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int n,l,r,a,b;
int main()
{
	freopen("candy.in","r",stdin);
	freopen("candy.out","w",stdout);
	cin>>n>>l>>r;
	a=l/n;
	b=r/n;
	l%=n;
	r%=n;
	if(b>a)cout<<n-1;
	else cout<<r;
	return 0;
}
